/*
 * Copyright (c) 2016, FPX and/or its affiliates. All rights reserved.
 * Use, Copy is subject to authorized license.
 */
package com.fpx.open.platform.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.fpx.open.platform.common.ConfigInfo;
import com.fpx.open.platform.dao.mapper1.ProductMappingMapper;
import com.fpx.open.platform.domain.prealert.ProductMapping;
import com.fpx.open.platform.service.ProductMappingService;

/**
 * 
 * @author shiw
 * @date 2016年8月27日
 */
//@Service
public class ProductMappingServiceImpl implements ProductMappingService {

	@Resource
	ProductMappingMapper productMappingMapper;
	
	@Resource
	private ConfigInfo configInfo;
	
	@Override
	public List<ProductMapping> queryProductMappingList() {
		return productMappingMapper.queryProductMappingList();
	}

	@Override
	public void saveProductMapping(ProductMapping productMapping, int type) {
		if(type == 0){
			productMapping.setCm_id(configInfo.getAeCustomerID());
			this.productMappingMapper.addProductMapping(productMapping);
		}else{
			this.productMappingMapper.updateProductMapping(productMapping);
		}
		
	}

	@Override
	public ProductMapping queryProductMapping(String pk_code_shipper) {
		return productMappingMapper.queryProductMapping(pk_code_shipper);
	}

}
